package com.xieli.invitesdk.ui

import android.content.Context
import android.graphics.Color
import android.net.ConnectivityManager
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.xieli.invitesdk.utils.ClickHandler
/**
 * @Auther sr
 * @Date 2023/9
 * @Description BaseActivity类,隐藏状态栏,标题栏,重写点击事件
 */
open class BaseActivity : AppCompatActivity(),
    View.OnClickListener {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        hideActionBar()
        configureStatusBar()
    }

    //隐藏标题栏
    private fun hideActionBar() {
        supportActionBar?.hide()
    }

    //隐藏状态栏
    private fun configureStatusBar() {
        window.apply {
            decorView.systemUiVisibility = (
                    View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
                            View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
                            View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
                    )
            statusBarColor = Color.TRANSPARENT
        }
    }

    //重写点击事件
    override fun onClick(v: View) {
        onQuickClick(v)
        //避免频繁点击
        if (!ClickHandler.isValidClick()) {
            return
        }
        onViewClick(v)
    }
    open fun onViewClick(view: View) {

    }
    open fun onQuickClick(v: View){

    }

}